#!/bin/env bash

# Sudo check
if [ "$EUID" -ne 0 ]
  then echo "Please run as root"
  exit
fi

apt update -y
apt upgrade -y
apt install dnsmasq psmisc -y


echo address=/flask/127.0.0.1 > /etc/dnsmasq.d/flask.conf
echo conf-dir=/etc/dnsmasq.d/,*.conf >> /etc/dnsmasq.conf

systemctl stop systemd-resolved
fuser -k 53/tcp
fuser -k 53/udp

cp /etc/resolv.conf /etc/resolv.conf.back
echo 'nameserver 127.0.0.1
nameserver 8.8.8.8' > /etc/resolv.conf
systemctl enable --now dnsmasq

